package org.jk.tools;

import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

import org.jk.jkdao.example.Auteurs;

public class IntrospectionClassTest {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		Auteurs aut = new Auteurs();
		aut.setId(1);
		aut.setNom("Moers");
		aut.setPrenom("Serge");
		aut.setAlias("Moers Serge");
		Object o = aut;
		IntrospectionClass cls = new IntrospectionClass(o);
		
		String[] filter = {"_"};
		cls.setFilterfield(filter);
		Field[] fld = cls.getFields();
		Method[] method = cls.getMethods(); 
		try{
			Object[] oo = new Object[1];
			String str = "Lulu";
			oo[0] = str;
			method[1].invoke(o,oo);
			for(int i=0;i<method.length;i++){
				System.out.println(method[i].getName() );
			}
			for(int i=0;i<fld.length;i++){
				System.out.println(fld[i].getName() );
				fld[i].setAccessible(true);
				System.out.println(fld[i].get(o) );
			}
			
			
			
		}
		catch(IllegalAccessException iae){
			
		}
		
		catch(InvocationTargetException iae){
			
		}
	}

}
